package at.ac.tuwien.dse.health.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Department within a {@link Hospital}.
 *
 * @author Bernhard Nickel
 * @author Gregor Schauer
 * @author Dominik Strasser
 */
@Entity
@NamedQueries(
		{
				@NamedQuery(name = Department.GET_DEPARTMENT_BY_NAME, query = "SELECT d FROM Department d WHERE name=:name"),
				@NamedQuery(name = Department.GET_DEPARTMENT_NAMES, query = "SELECT d.name FROM Department d")
		}
)
public class Department implements Serializable {
	public static final String GET_DEPARTMENT_BY_NAME = "Department#getDepartmentByName";
	public static final String GET_DEPARTMENT_NAMES = "Department#getDepartmentNames";
	private Long id;
	private String name;

	public Department() {
	}

	public Department(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return name;
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Basic(optional = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
